<template>
	<view class="activity-list-wrapper" @click="detail" v-if="Object.keys(info) != false">
		<view class="main-info">
			<view class="left">
				<image class="left_img" :src="info.cover" mode="aspectFill" lazy-load></image>
			</view>
			<view class="right">
				<view class="right-top">
					<view class="title">{{info?.name || ''}}</view>
					<view class="right-item location-info">
						<view class="name" v-if="info.price > 0">¥{{info.price}}/人</view>
					</view>
					<view class="right-item time-wrapper">
						<view class="name time-text">
							{{info.address}}&nbsp;&nbsp;{{typeFormat(info.type)}}
						</view>
					</view>
				</view>
				<view class="right-bottom">
					“{{info.describe}}”
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			info: {
				type: Object,
				default() {
					return {}
				}
			}
		},
		emits: ['detail'],
		data() {
			return {
			}
		},
		computed: {
		},
		methods: {
			detail() {
				const { id } = this.info
				uni.navigateTo({
					url: '/pages/merchant/detail?merchantId='+id
				})
				this.$emit('detail')
			},
			descFormat(describe) {
				if (describe.length > 30) {
					return describe.substr(0,30)+"...";
				}else{
					return describe;
				}
				
			},
			typeFormat(type) {
				//1-咖啡店 2-饮品店 3-酒吧 4-餐厅 5-其他
				switch (type){
					case 1:
						return '咖啡店'						
						break;
					case 2:
						return '饮品店'
						break;
					case 3:
						return '酒吧'
						break;
					case 4:
						return '餐厅'
						break;
					case 5:
						return '其他'
						break;
				}
			},
 		}
	}
</script>

<style scoped lang="scss">
	.activity-list-wrapper {
		background-color: #fff;
		position: relative;
		width: 718rpx;
		height: 256rpx;
		background: #FFFFFF;
		border-radius: 24rpx ;
		margin:0 auto;
		margin-bottom: 16rpx;
		.tag {
			position: absolute;
			left: 0;
			top: 0;
			height: 42rpx;
			min-width: 120rpx;
			padding: 0 16rpx;
			line-height: 42rpx;
			text-align: center;
			font-size: 22rpx;
			font-weight: 500;
			color: #fff;
			background: linear-gradient(to right, #FFDA43, #FFA437);
			border-radius: 20rpx 0 12rpx 0;
		}
		.tag-gray {
			background: #ddd;
			color: #666;
		}
	}
	
	.main-info {
		display: flex;
		
		.left {
			width: 196rpx;
			height: 224rpx;
			background-color: #f6f7f8;
			border-radius: 16rpx;
			overflow: hidden;
			&_img {
				width: 100%;
				height: 100%;
				border-radius: 16rpx;
			}
			margin-top: 16rpx;
			margin-left: 16rpx;
		}
		.right {
			width: calc(100% - 196rpx);
			padding-left: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			margin-top:16rpx;
			.right-top {
				width: 100%;
			}
			.right-bottom{
				width: 100%;
				height: 30rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #00CAC0;
				text-align: left;
				font-style: normal;
				text-transform: none;
				overflow: hidden;
			}
			.title {
				font-size: 28rpx;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				line-clamp: 2;
				-webkit-line-clamp: 2;
				overflow: hidden;
				font-weight: 500;
				//margin-bottom: 16rpx;
			}
			.right-item {
				width: 100%;
				display: flex;
				align-items: center;
				padding: 6rpx 0;
				color: #666;
				font-size: 24rpx;
				.name {
					padding-left: 8rpx;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					text-overflow: ellipsis;
					line-clamp: 1;
					-webkit-line-clamp: 1;
					overflow: hidden;
					max-width: calc(100% - 32rpx);
				}
				.shop-auth {
					width: 30rpx;
					height: 30rpx;
					margin-left: 8rpx;
				}
				.time-text {
					line-clamp: 2;
					-webkit-line-clamp: 2;
					font-size: 23rpx;
				}
				.icon-img {
					width: 32rpx;
					height: 32rpx;
				}
				.avatar {
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
					background-color: #eee;
				}
			}
			.time-wrapper {
				align-items: flex-start;
			}
		}
	}

	.other-info {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 30rpx;
		.report-person {
			font-size: 28rpx;
			color: #999;
		}
		.menu-desc {
			font-size: 30rpx;
			font-weight: bold;
			position: relative;
			display: flex;
			align-items: center;
			.price-list {
				color: $uni-color-primary;
				position: relative;
				z-index: 2;
			}
			.no-people {
				position: relative;
				z-index: 2;
				color: $uni-color-primary;
			}
			&::after {
				position: absolute;
				content: '';
				height: 16rpx;
				border-radius: 8rpx;
				background-color: #DDFFFD;
				bottom: 0;
				left: 0;
				right: 0;
				// z-index: 0;
			}
		}
	}
</style>